package com.sen.common.feign.config;

import feign.codec.Encoder;
import feign.form.spring.SpringFormEncoder;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.cloud.openfeign.support.SpringEncoder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

/**s
 * @author esjiang
 */
@Configuration
public class MultipartSupportConfig {

    @Resource
    private ObjectFactory<HttpMessageConverters> messageConvertersObjectFactory ;

    @Bean
    Encoder feignFormEncoder(){
        return new SpringFormEncoder(new SpringEncoder(messageConvertersObjectFactory)) ;
    }
}
